package com.pwt.controller.basicsetting;

import com.pwt.annotation.Update;
import com.pwt.common.CustomException;
import com.pwt.common.ResultPage;
import com.pwt.entity.MachineManage;
import com.pwt.entity.MachineProduct;
import com.pwt.entity.ProductAttribute;
import com.pwt.model.MachineManageModel;
import com.pwt.service.MachineManageService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author dw
 * @version 1.0.0
 * @date 2021/9/2
 */
@RestController
@Tag(name = "设置-机械管理")
public class MachineManageController {

    private MachineManageService machineManageService;

    public MachineManageController(MachineManageService machineManageService) {
        this.machineManageService = machineManageService;
    }


    @GetMapping("/machines")
    @Operation(description = "机器管理列表",summary = "机器管理列表")
    @Parameters({
            @Parameter(name = "name",description = "机器名称",required = false),
            @Parameter(name = "limit",description = "展示数",required = true),
            @Parameter(name = "page",description = "分页数",required = true)
    })
    public ResultPage<MachineManageModel> getList(@RequestParam(value = "name",required = false) String name, @RequestParam(value = "page",required = true) Integer page,
                              @RequestParam(value = "limit",required = true) Integer limit){
        return this.machineManageService.getList(name,page,limit);
    }
}
